Encoder with reference marks

ABSTRACT

A scale ( 10 ) has magnetic incremental scale marks in a track ( 10   a ), and a pseudo-random code sequence in a reference mark track ( 10   b ). Sensors ( 2,3 ) feed the pattern of the code in the track ( 10   b ) into a bi-directional shift register ( 18 ). So that a user can select any desired position for use as a reference mark, a memory ( 24 ) is provided, into which any selected code value can be pre-stored. A comparator ( 26 ) then compares the code value in the shift register ( 18 ) with the code value in the memory ( 24 ) and outputs a reference mark signal (Ri) when they match.

FIELD OF THE INVENTION

This invention relates to encoders. It is applicable to both rotary andlinear encoders for indicating the position, relative to each other, oftwo relatively movable members.

DESCRIPTION OF PRIOR ART

Known incremental encoders comprise a scale with regular incrementalmarks, and a scale reader which is movable along the scale, producingoutput pulses or cyclic waveforms in response to the incremental marksas they pass. The output is taken to a counter which counts theincremental pulses or cycles thus produced, making it possible tomeasure the distance travelled.

In an incremental scale, it is known to provide the incremental marks inone track along a scale, and also to provide one or more reference marks(commonly in a parallel track, though it has also been suggested toembed them in the incremental track). The readhead has a suitabledetector for detecting the reference mark. By resetting the counter tozero or some other preset value when the reference mark is detected, itis possible for the counter output to indicate an absolute position,e.g. the actual distance from the position of the reference mark.

It can be desirable to have several reference marks in the referencetrack, and to enable the user to select which of the reference marks touse, i.e. which one is to reset the counter. An example is shown in U.S.Pat. No. 4,459,750 (Affa), where a selector element may be positionedagainst a chosen reference mark. Problems with this include the factthat the reference marks are necessarily quite widely spaced from eachother. Thus, the user does not have a free choice for the preciseposition of the reference mark, and the readhead may have to be moved asignificant distance along the scale before a suitable reference mark isreached. There is also the need to mechanically position the selectorelement.

Absolute and quasi-absolute encoders are also known, in whichinformation encoding the absolute position along the scale is providedin one or more tracks of the scale. It is known from U.S. Pat. Nos.4,009,377 (Elms) and 6,127,948 (Hillis et al) that one way to encode theabsolute position is to use a pseudo-random code. The pseudo-random codeis decoded electronically or in a computer to obtain the absoluteposition. However, this does not address the provision of a referencemark in the manner discussed above, e.g. for resetting a counter.

SUMMARY OF THE INVENTION

One aspect of the present invention provides an encoder comprising ascale and a scale reader;

-   -   the scale having a plurality of reference marks spaced apart in        the lengthways direction;    -   the scale reader including a sensor which reads the reference        marks;    -   characterised in that:    -   the reference marks are arranged along the scale in a random or        pseudo-random pattern;    -   as the scale reader moves over the pattern of the reference        marks, the pattern is continually compared with a previously        stored pattern; and    -   when the pattern of the reference marks matches the previously        stored pattern, a reference signal is output.

Another aspect of the present invention provides an encoder comprising ascale and a scale reader;

-   -   the scale having a series of incremental marks extending along        its length, and a plurality of reference marks spaced apart in        the lengthways direction;    -   the scale reader including one or more sensors which read the        incremental marks and produce an output therefrom, and which        read the reference marks;    -   characterised in that:    -   the reference marks are arranged along the scale in a random or        pseudo-random pattern;    -   as the scale reader moves over the pattern of the reference        marks, the pattern is continually compared with a previously        stored pattern; and    -   when the pattern of the reference marks matches the previously        stored pattern, a reference signal is output.

The encoder may include a counter which indicates the position of thereadhead along the scale, said reference signal being connected to aninput of the counter to reset the counter to a preset value, such aszero.

In preferred embodiments, the scale reader reads the pattern of thereference marks into a shift register as it passes over them, and thepattern in the shift register is compared to the previously storedpattern. Values may be introduced into one end of the shift register,depending upon the values received from the pattern of the referencemarks, and these values may be shifted along the shift registersynchronously with the passing of the scale reader over the referencemarks. Preferably values may be introduced into either end of the shiftregister, depending upon the direction of travel of the scale readeralong the scale.

BRIEF DESCRIPTION OF THE DRAWINGS

A preferred embodiment of the invention will now be described by way ofexample, with reference to the accompanying drawings, wherein:

FIG. 1 is a schematic diagram of a first embodiment of an encoder,showing a scale, a readhead and circuitry for producing a referencesignal;

FIG. 2 is a schematic diagram of a second embodiment of an encoder;

FIG. 3 is a waveform diagram showing the timing of signals in the secondembodiment; and

FIG. 4 is a more detailed schematic diagram of the second embodiment.

DESCRIPTION OF PREFERRED EMBODIMENTS

FIG. 1 shows an elongate scale 10, along which a scale reader 12 canrun. In practice, the scale 10 and scale reader 12 are fixed torespective relatively movable members of a machine, and measure theirrelative movement.

The scale 10 includes an incremental track 10 a, comprising a series ofspaced marks which are read by a readhead or sensor 1 in the scalereader 12. In the preferred embodiment, the marks of the incrementaltrack are magnetic marks, spaced for example 1 mm apart, and thereadhead 1 is an integrated circuit chip designated POT sold by thepresent applicants RLS d.o.o., Slovenia.

This chip produces raw sine and cosine outputs (sin1, cos1) from thescale marks. From these it generates quadrature squarewaves on linesA,B, which by interpolation within the chip can be generated at 25 timesthe pitch of the incremental track 10 a. It also generates a referencepulse Ri1 every period of the incremental track, when sin1 equals cos1,and sin1 and cos1 are both greater than zero. This reference pulse has awidth corresponding to 10 μm.

An additional clock pulse CLK is derived every period of the incrementaltrack from the outputs sin1, cos1 of the readhead chip 1, by comparators50 and an AND gate 52.

The POT chip incorporates Hall effect sensors to react to the magneticscale marks. The technology for producing the signals sin1, cosl , A, Band Ri1 is well-known and will not be described further. Of course,scales with other pitches could be used. Other magnetic readheads couldbe used instead of the POT chips. The invention is also applicable toscales using technology other than magnetic, e.g. optical scales andopto-electronic scale readers.

The quadrature incremental signals A,B provide the main output of thedevice, and are taken to an up-down counter 70 in the normal way inorder to count the position of the scale reader 12 along the scale 10.In practice, this will usually be provided externally, in the customer'sequipment to which the scale and scale reader are to be fitted. Theexternal counter 70 counts the incremental signals A,B to provide anindication of the position of the scale reader relative to the scale. Asdescribed below, a signal Ri can reset this counter if the count shouldbecome incorrect for any reason.

The scale 10 also includes a coded reference track 10 b, alongside theincremental track 10 a. As shown, this may be produced simply byextending selected ones of the incremental marks sideways. However, itis possible to provide a separate reference track instead. It is alsopossible to provide two reference tracks, arranged symmetrically oneither side of the incremental track 10 a, so that the scale can befitted either way round in practice.

The magnetic marks in the reference track 10 b form a pseudo-random code(also known as a chain code sequence or pseudo-random binary sequence),chosen such that the code only repeats at certain intervals. In a simple4-bit example, the following code pattern may be used repeatedly:

. . . 0 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 . . .

(where 1 and 0 represent the presence and absence of a mark).

Each successive 4-bit pattern in this code provides a unique value.There sixteen different values, which repeat every 16 mm if the periodof the scale is 1 mm, as follows:

0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 00 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 0 0 0 0 0 0

In practice, it will often be preferable to use a longer pseudo-randomcode, for example an 8-bit code.

A suitable code pattern for an 8-bit code which repeats only every 256mm is follows:

... 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 10 0 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 1 10 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 11 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 1 10 0 1 0 1 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 10 0 1 1 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 10 1 1 0 1 1 0 1 0 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 00 0 0 0 0 0 ...

In this code sequence, each successive 8-bit pattern provides a uniquevalue. The first few of these values are as follows:

0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 01 1 0 0 0 0 0 1 1 0 0 0 etc.Even longer codes could be used if greater repeat intervals were needed,e.g. 14 or 15-bit codes. With a greater repeat interval, the user canhave a longer length of scale within which it is possible to select aunique code value for the reference.

The coded reference track 10 b is read by two readheads or sensors 2,3within the scale reader 12. For economy, these may be POT chips whichare identical with the readhead 1, although this is not essential. Asingle readhead for the reference track would also be possible, thoughthe reason we use two in the present embodiment will become apparentshortly. The position of readhead chip 1 relative to readhead chips 2and 3 should be such that the clock signal CLK appears at the time whenreadhead chips 2 and 3 are sensing the presence of a magnetic mark inthe reference track 10 b.

Analogue outputs from the POT chips 2,3 are used. These may be the sineor cosine signals, or a reference signal derived from them. The outputsfrom the chips 2,3 are taken to comparators 14,16, where they aresquared up. Thus, each comparator 14,16 provides a digital pulse train,which may be represented as a train of 0s and 1s, corresponding to thecode of the marks in the reference track 10 b.

As seen in FIG. 1, the pulse trains from the comparators 14,16 are fedto data inputs DSR,DSL at opposite ends of a bi-directional shiftregister 18. The shift register 18 has as many bits as the number ofbits of the pseudo-random code, e.g. 4 bits or 8 bits in the aboveexamples. The shift register 18 is clocked at an input CLK by thereference pulses from the comparators 50 and AND gate 52. Thus, one newdata bit is read into one or other end of the shift register for eachperiod of the scale 10, and this data bit will correspond to an 0 or 1of the pseudo-random code of the reference track 10 b.

A direction detector 20 receives the quadrature outputs A,B of thereadhead 1, and produces an output which is high or low, depending onthe direction of travel of the scale reader 12 along the scale 10. Thisis taken to a direction input SL and (via an inverter 22) to acomplementary direction input SR of the shift register 18, in order todetermine the direction in which the data bits are shifted through theshift register. Thus, when the scale reader moves towards the right (asseen in FIG. 1) new data values from the pseudo-random code in thereference track 10 b are picked up by the readhead 3 and fed into theshift register 18 from right to left via the input DSL. Conversely, whenthe scale reader 12 is moving towards the left, new values of thepseudo-random code are fed into the shift register from left to rightvia the input DSR.

The readheads 2,3 of the scale reader 12 are deliberately spaced apartby a distance corresponding to one word of the pseudo-random code. Thus,for example, in the case of a 4-bit code, and a 1 mm period scale, thereadheads 2,3 are spaced apart by 4 mm. In the case of an 8-bit code,and a 1 mm period, they are spaced by 8 mm.

It will be seen that as a result, the bits held in the shift register 18always correspond to the code bits which are in the reference track 10 bbetween the readheads 2,3, and are continually maintained up to date asthe scale reader 12 moves along the scale 10.

The readhead 1 is preferably spaced mid-way between the readheads 2,3 inthe scale reader 12. However, this is not essential, as long as thephase of the clock pulse CLK is correct, compared to the readheads 2 and3, so that the pulses from the code track are correctly sampled by theshift register 18.

When the scale 10 and scale reader 12 are installed on a machine, oneparticular value of the pseudo-random code will be chosen as a referencevalue, and as described below is stored in a memory 24. The memory 24may for example consist of an electrically erasable and programmableread-only memory (EEPROM). A comparator 26 continually compares theoutputs of the shift register 18 with the output of the memory 24.

When the scale reader 12 is moved into a position relative to the scale10 such that the value in the shift register 18 is equal to the value inthe memory 24, the comparator 26 provides an output to an AND gate 28.Here, it is ANDed with the 10 μm reference pulse Ri1, producing a 10 μmoutput Ri. This may be taken to the control system of the machine uponwhich the scale and scale reader are installed, as a reference pulse,for example in order to reset the external counter 70 which counts thequadrature signals A,B from the incremental track 10 a. The counter canthus be reset should it have lost count for any reason, e.g. when thesystem is first switched on or if there is a power outage or corruptionof the incremental signal from the scale.

The manner in which a selected code value is stored in the memory 24will now be described. The scale reader 12 is moved to a desiredposition on the scale 10, and an input is then provided to a “burn”input 30, e.g. from a push-button. This is taken via an AND gate 32 tothe memory 24, and causes the current value from the shift register 18to be burnt into the memory 24 via a bus 34.

However, it will be appreciated that if the system has just beenswitched on, the data in the shift register 18 will not be valid. Thescale reader 12 must move by at least the length of the code (e.g. 8 mmin the case of an 8-bit code and a 1 mm scale period) in order for thedata to be valid. This condition is indicated by the output of aflip-flop 36, which is reset upon power-up by a capacitor-resistorcircuit C,R. In this condition, it inhibits both the AND gate 32 (toprevent invalid data being burnt into the memory 24) and also the ANDgate 28 (to prevent an invalid output reference pulse Ri).

The flip-flop 36 is set, enabling the AND gates 32,28, when a counter 38and gate 40 indicate that the scale reader 12 has moved by a sufficientdistance. They do this by counting the clock pulses CLK from thereadhead 1.

In a simpler system, the memory 24 could be a DIP switch, having as manyas switches as there are bits of the pseudo-random code. The code valueat which the reference pulse Ri is to be generated is then set manuallyon these switches.

The second embodiment of encoder will now be described, with referenceto FIGS. 2–4. This embodiment requires only one readhead or sensor forthe coded reference marks, instead of the two readheads 2,3 in FIG. 1.

Referring to FIG. 2, the scale 10 may be the same as in FIG. 1,including a track 10 a with incremental scale marks, and a track 10 bwith reference marks in a pseudo-random code. For example, it may be the8-bit code described previously.

A scale reader 12 contains a readhead or sensor 1 for the incrementaltrack, which may be the same as in FIG. 1. This produces raw sine andcosine outputs 60 (shown in FIG. 3 and also schematically in FIG. 2)which are taken to an interpolator 62. The interpolator produces twodigital quadrature signals A,B, which as shown in FIG. 2 have afrequency 25 times the raw sine and cosine signals 60. Since there arefour zero crossing points in each period of the signals A,B, theinterpolation factor is effectively 100. FIG. 2 numbers theseinterpolated positions from 0–100 for reference purposes.

In addition to the digital quadrature signals A,B, the interpolator 62also produces a digital reference mark signal Ri1. As in the embodimentof FIG. 1, and shown in more detail in FIG. 3, the signal Ri1 isgenerated every period of the sine and cosine signals 60, at a time whenthe sine and cosine signals are equal and positive (the 45° position ofthe waveform).

The scale reader 12 also contains a sensor 4 for the code track 10 b.This produces an analogue code-signal 64, which is squared up to adigital code signal 68 by a comparator 66.

As in the FIG. 1 embodiment, the sensor 4 may be identical to the sensor1, but this is not essential.

In FIG. 3, the digital code signal 68 is shown for a position in thecode track 10 b where the code value is 1. It will be understood that ifthe code value is 0, then the code signal 68 would be zero.

FIG. 4 shows the circuitry for producing an output reference mark signalRi from the various signals shown in FIGS. 2 and 3. This reference marksignal Ri is generated at a position along the scale 10 which can beselected at will by the customer or user. In practice, the digitalquadrature signals A,B and the selectable reference mark signal Ri areall taken to an external counter, shown at 70 in FIG. 4, but usuallyprovided in practice in the customer's equipment to which the scale andscale reader are to be fitted. The external counter 70 counts theincremental signals A,B to provide an indication of the position of thescale reader relative to the scale. When it receives the reference marksignal Ri, the counter 70 is reset to zero or another preset value.

Apart from this external counter 70, the circuit of FIG. 4 includes afirst counter 72 which receives the signals A,B and Ri1 of FIGS. 2 and3. This counter counts up to a value of 100. It also determines thedirection of travel of the scale reader along the scale, providing adirection signal on a line 74. When the signal Ri1 appears, the state ofthe counter 72 is set to a value of either 100 or 0, received from aselector circuit 76. The selector 76 chooses the value, 100 or 0,depending on the direction of travel as indicated on the line 74.

Thus, the counter 72 outputs an indication of the position within onecycle of the sine and cosine signal 60, in terms of the 100 interpolatedvalues indicated for the digital quadrature signals A,B in FIG. 3.

The output of the first counter 72 is used to generate a clock signalClk, seen in FIG. 3. This clock signal is used to sample the digitalcode signal 68. The clock signal should be generated at a positionwithin the cycle which is most reliable for reading the information fromthe code track 10 b. This is determined experimentally, since it dependson the positioning of the sensors 1,4 relative to each other. In thepresent example, the interpolated position number 73 within the cycle isused. Therefore, a value 73 is preset into a code position circuit 78. Adigital comparator 80 compares the output of the counter 72 with thevalue from the code position circuit 78, generating the clock signal Clkwhen they are equal.

The values 68 of the pseudo-random code read from the code track 10 bare fed from the comparator 66 (FIG. 2) into a bi-directional shiftregister 82. The size of the shift register is double that of the codesize, i.e. 16 bits in the case of the present example of an 8-bitpseudo-random code. The pseudo-random code pattern 68 is fedsimultaneously to both ends of the shift register, at inputs DL and DR.However, which of these is effective to load the pattern depends on thedirection of travel as indicated on the line 74, which controls theshift direction of the shift register. At each pulse of the clock signalClk, a new value from the code pattern is loaded into one or other endof the shift register, and the remaining pattern is shifted left orright, as the case might be.

It will be appreciated that, since there is only one sensor 4 for thecode pattern, and since it is fed into the shift register at either enddepending on the direction of travel, either the bottom half or the tophalf of the shift register will contain valid data representing thepattern of the code track. Thus, for the purposes of subsequentprocessing, the shift register is considered in two separate parts, S1and S2. These are shown as separate boxes in FIG. 4, but it will beappreciated that this is merely for convenience in the followingdescription. The box S1 represents the lowest 8 bits of the shiftregister (referred to as B0–B7 below) which are used when the scalereader is moving to the right. The box S2 represents 8 bits of data fromthe upper part of the shift register 82, used when the scale reader ismoving to the left. However, it is not the topmost 8 bits, but is takenfrom a position one bit to the right (B7–B14 instead of B8–B15). Thiscompensates for a hysteresis of one position (one bit) caused when thedirection of travel changes.

A further counter 84 is used to determine the validity of data in thetwo halves of the shift register 82. The counter 84 counts pulses of theclock signal Clk. It counts up and down between a maximum value of 8 anda minimum value of −8, and it receives an input from the line 74indicating the direction of travel. After counting up to the maximumvalue of 8, the next clock pulse causes it to roll around to −8 (andvice versa if the direction of travel is reversed).

On power up, all the data in the counters 72, 84 and the shift register82 are zero. First, synchronisation must be established between thefirst counter 72 and the incremental scale track 10 a. The counter 72 isdisabled until the first pulse Ri1 is detected, which then enables thatcounter. After power up, the scale reader 12 must move for 16 mm ineither direction before succeeding actions are enabled. This ensuresthat the shift register 82 is filled with data.

As in the FIG. 1 embodiment, the code value for the position of thereference mark selected by the customer or user is stored in an EEPROM.Like the shift register 82, this should be twice the size of the codevalue, and is considered as being split into two halves, D1 and D2. D1contains the upper 8 bits B8-B15 of a code pattern while D2 contains thelower 8 bits B0–B7. It will be understood that for economy a singleEEPROM will contain both halves D1 and D2, but they may be separate ifrequired.

The customer or user stores a reference mark in the EEPROM D1,D2 asfollows.

The output of the counter 84 is indicated in a box 86, and for thepurpose of storing the code value in the EEPROM D1,D2 only output values8 or −8 of the counter 84 are deemed valid. To store the value for aselected reference mark, the customer first moves the scale reader 12 toa desired position on the scale 10. He then provides an input on a line90, for example using a push button With continuous movement of thescale reader in either direction for at least 16 mm, gates 88 thenenable a preset input to the EEPROM D1,D2 at a time when the outputs 86of the counter 84 have a value 8 or −8. The entire contents of the shiftregister 82 are then transferred into the corresponding bits of theEEPROM D1,D2.

During normal use of the encoder, it is required to provide the outputRi every time the position of the selected reference mark is passed, ineither direction of travel. An output 94 of the counter 84 indicateswhether the value stored in the counter (as indicated at 86) is positive(greater than or equal to zero) or negative (less than zero). Thisoutput 94 is used to enable and disable gating circuitry 92, to selecteither the output of a comparator Comp1 or Comp2. Comp1 compares theEEPROM data D2 with the shift register data S1, while Comp2 compares theEEPROM data D1 with the shift register data S2. When the enabledcomparator Comp1 or Comp2 indicates that a match has been achieved (i.e.that the scale reader 12 is in the position of the selected referencemark) the output signal Ri is generated. It is gated in a gate 96 withthe signal Ri1, to ensure a consistent pulse width of 10 micrometers asin FIG. 1.

The actual position of the reference value will be 8 mm (i.e. 8 bits ata pitch of 1 mm) back from the position when it was stored in the EEPROMD1,D2. The reason is as follows. We are using only one sensor to readthe reference code track, and the EEPROM stores a value which is doublethe length of the reference code. When the system is operating, theupper part of the shift register is compared with the EEPROM datareceived from the lower part of the shift register when the data wasstored (and vice versa). The above-noted shift in the position of thereference mark arises as a consequence.

With the example of an 8 bit code and a 1 mm pitch, it is possible toset a reference mark which is unique within 256 mm of scale. Codes withlarger number of bits can be used to provide a unique reference mark inlonger lengths of scale.

A particular advantage of the systems described is that the customer canselect a reference mark within a very close distance of any desiredposition on the scale. This is a considerable improvement over prior artsystems, e.g. of the type where each reference mark is provided with aunique selectable distance code, which unfortunately takes up space inthe code track. Selection of the reference mark can be done entirelyelectronically, just by pushing a button, with no mechanical parts to beset up. Furthermore, since the reference code only repeats every 256 mm(for example) it is possible to provide arbitrary lengths of scale, ofany length up to 256 mm. These can be cut off as required from a scalewhich is many meters long, provided as a reel of tape scale, without alarge number of wasteful offcuts.

It would also be possible to provide a code with more bits, e.g. suchthat the reference code never repeats in 32 meters. Any desired lengthcan then be cut off, either a very small length or a long length up tothe full 32 meters.

The invention is useful for other types of scales in addition to themagnetic type described. For example, in an optical scale with a muchsmaller pitch than 1 mm, it would be necessary to use a code with morebits, to ensure that a reference mark code will be unique in areasonably long length of scale. But it will still be possible to selecta reference mark within a very close distance of any desired position onthe scale. It is also possible to have a hybrid system, in which theincremental track is optical (for high resolution and accuracy) whilethe reference mark is provided magnetically as described above. Oranother hybrid system might have an optical incremental track producedby laser ablation, with the reference code track produced by anotheroptical technology.

An extension to the systems described would allow for multipleprogrammable reference marks at different positions along the scale.This merely requires a corresponding number of memories for the marks tobe programmed, and comparators for each to compare the pattern values inthe shift register. One use would be a system with two or more limitmarks. A system without an incremental track could be used for aprogrammable safety system.

The invention has been described using linear scales as examples, butmay also be used in a code disk of a rotary encoder, both for measuringover complete revolutions and in systems for measuring partial arcs.

Systems without a shift register can also be envisaged. For example, thecode pattern could be read with a line camera which images multiple bitsof the code pattern onto an array of sensor elements.

1. An encoder comprising a scale and a scale reader; the scale having aplurality of reference marks spaced apart from each other; the scalereader including a sensor which reads the reference marks; characterizedin that: the reference marks are arranged along the scale in a random orpseudo-random pattern; as the scale reader moves over the pattern of thereference marks, the pattern is continually compared with a previouslystored pattern; and when the pattern of the reference marks matches thepreviously stored pattern, a reference signal is output.
 2. An encoderaccording to claim 1, including a counter which indicates the positionof the readhead along the scale, said reference signal being connectedto an input of the counter to reset the counter to a preset value.
 3. Anencoder according to claim 1, including a shift register, wherein valuesrepresenting the pattern of the reference marks are read into the shiftregister as the scale reader passes over the reference marks, and thepattern in the shift register is compared to the previously storedpattern.
 4. An encoder according to claim 3, wherein said values areintroduced into one end of the shift register, and shifted along theshift register synchronously with the passing of the scale reader overthe reference marks.
 5. An encoder according to claim 3, wherein saidvalues may be introduced into either end of the shift register,depending upon the direction of travel of the scale reader along thescale.
 6. An encoder according to claim 3, including a memory forholding said previously stored pattern, and a comparator which comparesthe pattern of the reference marks in the shift register with thepreviously stored pattern in the memory.
 7. An encoder according toclaim 6, including an input to the memory for storing said storedpattern therein, the pattern being received from the shift register. 8.An encoder according to claim 7, including a circuit for determining thevalidity of the pattern in the shift register, and preventing said inputbeing stored in the memory if it is invalid.
 9. An encoder according toclaim 1, including a memory for holding said previously stored pattern,and a comparator which compares the pattern of the reference marks fromthe scale with the previously stored pattern in the memory.
 10. Anencoder according to claim 9, including an input to the memory forstoring said stored pattern therein, the pattern being received from thescale reader as the scale reader passes over the reference marks.
 11. Anencoder comprising a scale and a scale reader; the scale having a seriesof incremental marks, and a plurality of reference marks spaced apartfrom each other; the scale reader including one or more sensors whichread the incremental marks and produce an output therefrom, and whichread the reference marks; characterized in that: the reference marks arearranged along the scale in a random or pseudo-random pattern; as thescale reader moves over the pattern of the reference marks, the patternis continually compared with a previously stored pattern; and when thepattern of the reference marks matches the previously stored pattern, areference signal is output.